<?php

namespace Apps\Common\Models;

/**
 * 用户属性类型说明Model
 * @author     chenxiaolin
 * @date        2016年1月19日
 * @version     2.0.0
 * @copyright   Copyright 2016 meelier.com
 */
class UserAttributeType extends \PhalconPlus\Database\Model
{

    /**
     *
     * @var integer
     */
    public $type_id;

    /**
     *
     * @var string
     */
    public $type_title;

    /**
     *
     * @var string
     */
    public $type_remark;

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->hasMany('type_id', 'Apps\Common\Models\UserAttribute', 'attr_type', array('alias' => 'UserAttribute'));
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'user_attribute_type';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return UserAttributeType[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return UserAttributeType
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    /**
     * Independent Column Mapping.
     * Keys are the real names in the table and the values their names in the application
     *
     * @return array
     */
    public function columnMap()
    {
        return array(
            'type_id' => 'type_id',
            'type_title' => 'type_title',
            'type_remark' => 'type_remark'
        );
    }

    public function defaultColumns()
    {
        return [
            'type_remark',
        ];
    }

}
